package com.pig4cloud.pig.demo.Service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.pig4cloud.pig.demo.Mapper.TitleMapper;
import com.pig4cloud.pig.demo.Service.TitleService;
import com.pig4cloud.pig.demo.feign.Entity.Title;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TitleServiceImpl implements TitleService {
    @Autowired
    private TitleMapper titleMapper;

    @Override
    public int insertTitle(Title title) {
        return titleMapper.insert(title);
    }

    @Override
    public Long findByCategory(String category) {
        QueryWrapper<Title> wrapper = new QueryWrapper<Title>();
        wrapper.eq("category",category);
        return titleMapper.selectOne(wrapper).getId();
    }
}
